package com.nulldev.util.concurrency.threadIt.v4.utils.impls;

import java.util.concurrent.TimeUnit;

public class LatchableSemaphore extends FlexibleSemaphore {

	private static final long serialVersionUID = -8420367545249836702L;

	public LatchableSemaphore(final int permits) {
		super(permits);
	}

	public LatchableSemaphore(final int permits, final boolean fifo) {
		super(permits, fifo);
	}

	@Override
	public void acquire() throws InterruptedException {
		super.acquire();
	}

	@Override
	public void acquire(final int permits) throws InterruptedException {
		super.acquire(permits);
	}

	@Override
	public void release() {
		super.release();
	}

	@Override
	public void release(final int permits) {
		super.release(permits);
	}

	@Override
	public void acquireUninterruptibly() {
		super.acquireUninterruptibly();
	}

	@Override
	public void acquireUninterruptibly(final int permits) {
		super.acquireUninterruptibly(permits);
	}

	@Override
	public boolean tryAcquire() {
		return super.tryAcquire();
	}

	@Override
	public boolean tryAcquire(final int permits) {
		return super.tryAcquire(permits);
	}

	@Override
	public boolean tryAcquire(final int permits, final long timeout, final TimeUnit unit) throws InterruptedException {
		return super.tryAcquire(permits, timeout, unit);
	}

	@Override
	public boolean tryAcquire(final long timeout, final TimeUnit unit) throws InterruptedException {
		return super.tryAcquire(timeout, unit);
	}

	public boolean isInactive() {
		return sync.getPermits() > 0;
	}

	public void reset() {
		/* TODO: Reset the permit and locks */
	}
}
